import { ProxyOptions } from 'vite'
/**
 * 开发服务器配置自定义代理规则
 * https://cn.vitejs.dev/config/server-options.html#server-proxy
 */

// const url = 'https://sfu.kedacom.com/'
// const url2 = 'https://10.67.18.95/'
// const url = 'http://10.67.0.23:8097/'

const url2 = 'https://10.67.16.159/'
const url = 'http://10.67.16.159/'
// const url2 = 'https://172.16.237.23/'
// const url = 'https://172.16.237.23/'
// const url = 'http://10.67.18.192/'
// const url2 = 'http://10.67.18.192/'
const proxy: Record<string, string | ProxyOptions> = {
	'/kdv/biz/bp.min.js': {
		target: url2 + '/meeting/kdv/biz/bp.min.js',
		changeOrigin: true,
		secure: false,
		cookieDomainRewrite: 'localhost',
		rewrite: (path) => path.replace('/kdv/biz/bp.min.js', ''),
	},
	'/meetingapiweb/': {
		target: url + '/meetingapiweb/',
		changeOrigin: true,
		secure: false,
		cookieDomainRewrite: 'localhost',
		rewrite: (path) => path.replace(/^\/meetingapiweb\//, ''),
	},
	'/meetingapicoreweb/': {
		target: url + '/meetingapicoreweb/',
		changeOrigin: true,
		secure: false,
		cookieDomainRewrite: 'localhost',
		rewrite: (path) => path.replace(/^\/meetingapicoreweb\//, ''),
	},
	'/kis/': {
		target: url2 + '/kis/',
		changeOrigin: true,
		secure: false,
		cookieDomainRewrite: 'localhost',
		rewrite: (path) => path.replace(/^\/kis\//, ''),
	},

	'/web': {
		target: url2 + '/web/',
		changeOrigin: true,
		secure: false,
		cookieDomainRewrite: 'localhost',
		rewrite: (path) => path.replace('/web', ''),
	},
	'/portal': {
		target: url2 + '/portal/',
		changeOrigin: true,
		secure: false,
		cookieDomainRewrite: 'localhost',
		rewrite: (path) => path.replace('/portal', ''),
	},

	'/service/cometd': {
		target: url2 + '/service/cometd',
		changeOrigin: true,
		cookieDomainRewrite: 'localhost',
		ws: true,
		secure: false,
		rewrite: (path) => path.replace('/service/cometd', ''),
	},
	'/service': {
		target: url2 + '/service/',
		changeOrigin: true,
		secure: false,
		cookieDomainRewrite: 'localhost',
		rewrite: (path) => path.replace(/^\/service/, ''),
	},
}
export default proxy
